package com.young.weixin.model.message;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.young.weixin.model.enums.EWxMessageTypeEnum;

/**
 * 图片消息
 *
 * @author wangjiyu
 * @date 2021/10/5 17:05
 */
@XStreamAlias("xml")
public class WxImageMessage extends WxBaseMessage {
    /**
     * 图片链接
     */
    @XStreamAlias("PicUrl")
    private String picUrl;
    /**
     * 媒体id
     */
    @XStreamAlias("MediaId")
    private String mediaId;


    /**
     * 构造消息对象
     *
     * @param fromUser 发送人
     * @param toUser   接收人
     * @return 消息对象
     */
    @Override
    public WxImageMessage build(String fromUser, String toUser) {
        WxImageMessage message = new WxImageMessage();
        message.fillWxBaseMessage(fromUser, toUser, EWxMessageTypeEnum.IMAGE);
        return message;
    }

    /**
     * 构造消息对象
     *
     * @param messageMapWrapper 参数map
     * @return 消息对象
     */
    @Override
    public WxImageMessage convert(WxMessageMapWrapper messageMapWrapper) {
        WxImageMessage message = new WxImageMessage();
        message.fillWxBaseMessage(messageMapWrapper);
        message.setPicUrl(messageMapWrapper.getPicUrl());
        message.setMediaId(messageMapWrapper.getMediaId());
        return message;
    }

    public WxImageMessage() {
        super();
    }

    public String getPicUrl() {
        return picUrl;
    }

    public void setPicUrl(String picUrl) {
        this.picUrl = picUrl;
    }

    public String getMediaId() {
        return mediaId;
    }

    public void setMediaId(String mediaId) {
        this.mediaId = mediaId;
    }
}
